package com.example.intenttrial.adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.intenttrial.R;

public class GalleryAdapter extends BaseAdapter{

		private static final String[] items = {"Vimeo", "YouTube", "Player", "Request", "Empty", "SDCard", "Progress and wifi", "Uninstall", "Bitmap Optimization", "pdf", "Gallery"};
		
		private LayoutInflater inflater;
		private Context context;
		
		public GalleryAdapter(Context context) {
			this.context = context;
			this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		}
		
		@Override
		public int getCount() {
			return items.length;
		}

		@Override
		public Object getItem(int pos) {
			return items[pos];
		}

		@Override
		public long getItemId(int arg0) {
			return 0;
		}

		@Override
		public View getView(int pos, View view, ViewGroup viewGroup) {
			
			if(view == null) {
				view = (View) inflater.inflate(R.layout.listitem_gallery_item, null); 
			}
			
			TextView tv = (TextView)view.findViewById(R.id.tv_gallery_name);
			
			tv.setText(items[pos]);
			
			return view;
		}
}
